package cn.tk.utils;

import org.jasypt.util.text.BasicTextEncryptor;

/**
 * @author itw_lucc01
 */
public class JasyptUtil {
	public static String encrypt(String password, String message) {
		BasicTextEncryptor encryptor = new BasicTextEncryptor();
		encryptor.setPassword(password);
		return encryptor.encrypt(message);
	}

	public static String decrypt(String password, String message) {
		BasicTextEncryptor encryptor = new BasicTextEncryptor();
		encryptor.setPassword(password);
		return encryptor.decrypt(message);
	}

	public static void main(String[] args) {

		String str = encrypt("robotai", "WhRobotTeam2017!");
		System.out.println(str);

		String str1 = decrypt("robotai", str);
		System.out.println(str1);

	}

}
